package com.xdog.web3.domain.transactionhistory;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
@Schema(description = "交易历史响应数据")
public class TransactionsByAddressResponse {
    
    @Schema(description = "游标")
    private String cursor;
    
    @Schema(description = "交易列表")
    private List<TransactionInfo> transactionList;
    
    @Data
    @Schema(description = "交易信息")
    public static class TransactionInfo {
        
        @Schema(description = "链 ID")
        private String chainIndex;
        
        @Schema(description = "交易 hash")
        private String txHash;
        
        @Schema(description = "交易的层级类型 0:外层主链币转移 1:合约内层主链币转移 2:token转移")
        private String itype;
        
        @Schema(description = "合约调用函数")
        private String methodId;
        
        @Schema(description = "发起者地址发起的第几笔交易")
        private String nonce;
        
        @Schema(description = "交易时间；Unix时间戳的毫秒数格式，如 1597026383085")
        private String txTime;
        
        @Schema(description = "交易输入")
        private List<FromInfo> from;
        
        @Schema(description = "交易输出")
        private List<ToInfo> to;
        
        @Schema(description = "代币的合约地址")
        private String tokenContractAddress;
        
        @Schema(description = "交易数量")
        private String amount;
        
        @Schema(description = "交易数量对应的币种")
        private String symbol;
        
        @Schema(description = "手续费")
        private String txFee;
        
        @Schema(description = "交易状态、success 成功、fail 失败、pending 等待确认")
        private String txStatus;
        
        @Schema(description = "false：不是黑名单 true：是黑名单")
        private Boolean hitBlacklist;
        
        @Schema(description = "标签")
        private String tag;
    }
    
    @Data
    @Schema(description = "交易输入信息")
    public static class FromInfo {
        
        @Schema(description = "发送/输入地址，多签交易时，逗号分隔")
        private String address;
        
        @Schema(description = "输入数量")
        private String amount;
    }
    
    @Data
    @Schema(description = "交易输出信息")
    public static class ToInfo {
        
        @Schema(description = "接收。输出地址，多签交易时，逗号分隔")
        private String address;
        
        @Schema(description = "输出数量")
        private String amount;
    }
}